package com.pignest.hotel.ui.selfhelp;

import org.zkoss.zul.Iframe;

import com.pignest.hotel.beans.Member;
import com.pignest.hotel.beans.Room;
import com.pignest.hotel.spring.Services;
import com.pignest.hotel.ui.room.RoomSelectedListener;

public class RoomSelectedListenerFrame extends Iframe implements RoomSelectedListener {

	private static final long serialVersionUID = 1934615813025932785L;
	
	private Member member;

	@Override
	public void onSelected(String roomId, boolean selected) {
		if (!selected) {
			return;
		}
		String src = "roomShow.jsp";
		if (roomId != null&&this.member!=null) {
			Room room = Services.getRoomService().getRoom(roomId);
			if (room != null) {
				src += "?roomId=" + roomId+"&memberId="+member.getId();
			}
		}
		setSrc(src);
	}
	public void setMember(Member member) {
		this.member = member;
	}

}
